SConscriptChdir(0)

import os

def RBConfig(param):
	return os.popen('ruby -e"require \'rbconfig\'; print Config::CONFIG[\'' + param + '\']"').read()

#SConscript([
#	'Chipmunk/SConscript',
#	'Photon/SConscript',
#])

env = Environment(
	# GCC flags for building libchipmunk
	CCFLAGS = RBConfig('CFLAGS').split() + ['-Os', '-std=gnu99'] + [
		'-Fmacosx/universal_libs',
		'-arch', 'ppc', '-arch', 'i386',
	],
	CPPPATH = [
		RBConfig('topdir'), 
		'macosx',
		'macosx/universal_libs/include', 
		'src/base', 
		'src/oggstreamer'
	],
	LINKFLAGS = ['-Fmacosx/universal_libs', '-arch', 'ppc', '-arch', 'i386', 'macosx/universal_libs/lib/libpng.a'],
	FRAMEWORKS=['Cocoa', 'OpenGL', 'OpenAL', 'SDL', 'Ogg', 'Vorbis'],
)

src = [
	'macosx/SDLMain.m',
	'src/main.c',
	Glob('src/base/*.c'),
	'src/oggstreamer/oggstreamer.c',
	Glob('src/opengl/*.c'),
	Glob('src/openal/*.c'),
]

aerosol = env.Program(
	'prog',
	src,
	LIBS = [RBConfig('LIBRUBYARG_SHARED'), 'z'],
#	LIBPATH = ['.', 'macosx/universal_libs/lib'],
)

Default(aerosol)
